#CXX=g++44

CXX=/opt/openmpi-1.4.3-gcc44/bin/mpic++

CFLAGS += -Wall -O3 -fopenmp
CXXFLAGS += -Wall -O3 -fopenmp

#LDLIBS += -lstdc++ -L$(MKLROOT)/lib/em64t  -Wl,--start-group -lmkl_intel_ilp64 -lmkl_sequential -lmkl_core -Wl,--end-group -lpthread -DMKL_ILP64  -m64
LDLIBS += -lstdc++  -Wl,--start-group $(MKLROOT)/lib/em64t/libmkl_intel_ilp64.a $(MKLROOT)/lib/em64t/libmkl_sequential.a $(MKLROOT)/lib/em64t/libmkl_core.a -Wl,--end-group -lpthread -DMKL_ILP64 -m64

RM=/bin/rm -rf

# CXXFLAGS 

all: main scaling

main: main.o oblivious.o distributed_mult.o
	$(CXX) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(LDLIBS)

scaling: scaling.o oblivious.o distributed_mult.o
	$(CXX) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(LDLIBS)

oblivious.o: oblivious.cpp oblivious.h
	$(CXX) $(CFLAGS) -c oblivious.cpp -o oblivious.o $(LDFLAGS) $(LDLIBS)

distributed_multi.o: distributed_mult.cpp distributed_mult.h oblivious.o
	$(CXX) $(CFLAGS) -c distributed_mult.cpp -o distributed_mult.o $(LDFLAGS) $(LDLIBS)

run-experiments: scaling experiments.rb
	ruby experiments.rb

clean: 
	-rm *.o main test scaling

.PHONY : clean, run-experiments
